package com.logisticsinquiry.android.ui.query

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.logisticsinquiry.android.logic.Repository
import com.logisticsinquiry.android.logic.entity.ShipperCodeResponseHistory
import com.logisticsinquiry.android.logic.model.ShipperCodeResponse

class QueryViewModel: ViewModel() {

    private val logisticCodeLiveData = MutableLiveData<String>()
    var traceList = ArrayList<ShipperCodeResponseHistory>()
    val searchShipperLiveData = Transformations.switchMap(logisticCodeLiveData){
            logisticCode ->
        Repository.searchShipper(logisticCode)
    }

    fun searchShipper(logisticCode: String){
        logisticCodeLiveData.value = logisticCode
    }
}